home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
hity wydania
/
Ubuntu 9.10 PL
/
karmelkowy-koliberek-desktop-9.10-i386-PL.iso
/
casper
/
filesystem.squashfs
/
usr
/
bin
/
add-apt-repository
< prev
next >
Wrap
Text File
|
2009-09-07
|
797b
|
34 lines
#!/usr/bin/python
import os
import sys
import gettext
import locale
from softwareproperties.SoftwareProperties import SoftwareProperties
from optparse import OptionParser
from gettext import gettext as _
if __name__ == "__main__":
locale.setlocale(locale.LC_ALL, "")
parser = OptionParser()
(options, args) = parser.parse_args()
if os.geteuid() != 0:
print _("Error: must run as root")
sys.exit(1)
if (len(args) != 1):
print _("Error: need a repository as argument")
sys.exit(1)
# force new ppa file to be 644 (LP: #399709)
os.umask(0022)
sp = SoftwareProperties(options)
line = args[0]
if not sp.add_source_from_line(line):
print _("Error: '%s' invalid" % line)
sys.exit(1)
sp.sourceslist.save()